﻿using JetBrains.Annotations;
using Missbot.Service;
using MissRobot.Migrator.SourceMongo;

namespace MissRobot.Migrator.Migrators
{
    [UsedImplicitly]
    public class ExpeditionHistoryMig : IMigrator
    {
        public void Migrate(long QQNum, string UserID)
        {
            var rec = SourceMongoService<ExpeditionHistory>.GetOnly(p => p.QQNum == QQNum);
            rec.UserID = UserID;
            rec.Id     = MongoDB.Bson.ObjectId.GenerateNewId().ToString();
            MongoService<Missbot.AIModule.Pet.Expedition.ExpeditionHistory>.DeleteMany(p => p.UserID == UserID);
            MongoService<Missbot.AIModule.Pet.Expedition.ExpeditionHistory>.Insert(rec);
        }
    }

    public class ExpeditionHistory : Missbot.AIModule.Pet.Expedition.ExpeditionHistory
    {
        public long QQNum { get; set; }
    }
}